#ifndef _TJPRIMITIVE742011_H_
#define _TJPRIMITIVE742011_H_

#include "tj_ray.h"

class IPrimitive 
{
public:
	virtual ~IPrimitive() {}

	virtual const bool getIntersect(const Ray& line, TinyPlane& hitPos) const = 0;

	virtual Box* constructBoundingBox() const = 0;

	virtual Sphere* constructBoundingShpere() const = 0;
};

class Box: public IPrimitive 
{
public:
private:
	float length;
	float width;
	float height;
};

class Sphere: public IPrimitive 
{
public:
private:
	float radius;
};

class Shape: public IPrimitive
{
public:
private:
};

class Square: public Shape
{
public:
private:
};

class Circle: public Shape
{
public:
private:
};

class Function 
{
	virtual ~Function();

	virtual float calc(float x, float y) const = 0;
};

/**
 * z = function(x, y)
 */
class ParametricSurface: public IPrimitive
{
public:
private:
	Function *func;
	Shape* bound;
};

class MultiSurface: public IPrimitive
{
public:
private:
	DArray<*ParametricSurface> subSurfaces;
};



class Mesh: public IPrimitive
{
public:
private:
	DArray<int> indexBuffer;
	DArray<vec4> vertexBuffer;
	DArray<vec3> normalBuffer;
	DArray<vec2> textureBuffer;
};

#endif // _TJPRIMITIVE742011_H_